package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 账户
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_user_account`", autoResultMap = true)
public class LyUserAccount {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @NotNull
    @ApiModelProperty("用户表的用户ID")
    @TableField(value = "`user_id`")
    private Integer userId;


    @Digits(integer = 10 - 2, fraction = 2)
    @ApiModelProperty("账户总余额")
    @TableField(value = "`remain_amount`")
    private BigDecimal remainAmount;


    @Digits(integer = 10 - 2, fraction = 2)
    @ApiModelProperty("账户总额")
    @TableField(value = "`total_amount`")
    private BigDecimal totalAmount;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("修改时间")
    @TableField(value = "`modify_time`")
    private LocalDateTime modifyTime;


    @ApiModelProperty("结算利率：5 表示5%或0.05")
    @TableField(value = "`settlement_rate`")
    private Integer settlementRate;


    @ApiModelProperty("账户状态")
    @TableField(value = "`status`")
    private Integer status;


    @Length(max = 255, message = "分享推广二维码URL长度不能超过255位")
    @ApiModelProperty("分享推广二维码URL")
    @TableField(value = "`share_url`")
    private String shareUrl;

}
